#ifndef TEST2_CPP
#define TEST2_CPP
#include "serialization/JsonSerializationHelper.hpp"

namespace JSerialization {
struct data_base
{
    int a{1};
    int b{2};
    JSON_HELPER(a, b)
};

struct data: public data_base
{
    int c{3};
    JSON_HELPER(c)
    JSON_HELPER_BASE((data_base*)this)
};

void test2()
{
    data_base* d = new data();

    std::string strJson;
    // 序列化为json
    JsonSerializationHelper::ObjectToJson(d, strJson, 4);
    LOG(strJson);

    data s2;
    s2.a = 0;
    s2.b = 0;
    s2.c = 0;
    // 反序列化为对象
    JsonSerializationHelper::JsonToObject(s2, strJson);

    // std::cout << strJson << std::endl;

}

}
#endif // TEST2_CPP
